package com.hoe.tsb.fraft.client;

import com.hoe.tsb.Configuration;
import com.hoe.tsb.fraft.event.ConnectEvent;
import com.hoe.tsb.fraft.listener.FRaftClientListener;
import com.hoe.tsb.web.NodeProperties;

/**
 * <p>
 * 对FRaft客户端的简单实现
 * </p>
 *
 * @author hoe
 * @version 1.0
 * @date 2022/11/21 17:54
 */
public class SimpleClient extends AbstractClient implements FRaftClientListener {

    private static SimpleClient client;

    private SimpleClient(NodeProperties properties, Configuration config) {
        super(properties, config);
    }

    public static SimpleClient getClient(NodeProperties properties, Configuration config) {
        if (client != null) {
            return client;
        }

        synchronized (SimpleClient.class) {
            if (client == null) {
                client = new SimpleClient(properties, config);
            }

            return client;
        }
    }

    @Override
    public void callback(ConnectEvent event) {

    }

}
